/* Copyright Thanh-Trung Pham, 2015 */
package jp.ac.uaizu.control;

import jp.ac.jaist.input.RMPIIAWrapper;
import jp.ac.jaist.input.RMPIInputModeler;
import jp.ac.jaist.simulation.RMPIReliabilitySimulationStatistics;
import jp.ac.uaizu.translation.InputModel;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Thanh-Trung Pham
 */
public class SerCompPredictionWork {
    public static final int COMPLETED_STATE = 2;
    public static final int RUNNING_STATE = 1;
    public static final int QUEUED_STATE = 0;
    public static final int UNKNOWN_STATE = -1;

    public String m_strPredictionID;

    public RMPIInputModeler m_oRMPIInputModeler;
    public InputModel m_oInputModel;

    public int m_iState = UNKNOWN_STATE;
    public RMPIIAWrapper m_oRMPIIAWrapper; //prediction results of the analytical method.

    public List<RMPIReliabilitySimulationStatistics> m_oAllSimulationStatistics; //list of prediction results of the simulation method.

    /**
     * The constructor.
     * @param predictionID the prediction ID.
     * @param rmpiInputModeler the RMPI Input Modeler.
     * @param inputModel the input model.
     */
    public SerCompPredictionWork(String predictionID, RMPIInputModeler rmpiInputModeler, InputModel inputModel) {
        m_strPredictionID = predictionID;

        m_oRMPIInputModeler = rmpiInputModeler;
        m_oInputModel = inputModel;
    }

    /**
     * Add the simulation statistics.
     * @param simulationStatistics the simulation statistics
     */
    public void addRMPIReliabilitySimulationStatistics(RMPIReliabilitySimulationStatistics simulationStatistics){
        if(m_oAllSimulationStatistics == null){
            m_oAllSimulationStatistics = new ArrayList<RMPIReliabilitySimulationStatistics>();
        }

        m_oAllSimulationStatistics.add(simulationStatistics);
    }


    /**
     * Get all the simulation statistics.
     * @return all the simulation statistics.
     */
    public List<RMPIReliabilitySimulationStatistics> getAllSimulationStatistics(){
        return m_oAllSimulationStatistics;
    }

    /**
     * Get the prediction ID.
     * @return the prediction ID.
     */
    public String getPredictionID() {
        return m_strPredictionID;
    }

    /**
     * Get the RMPI Input Modeler.
     * @return the RMPI Input Modeler.
     */
    public RMPIInputModeler getRMPIInputModeler() {
        return m_oRMPIInputModeler;
    }

    /**
     * Get the input model.
     * @return the input model.
     */
    public InputModel getInputModel() {
        return m_oInputModel;
    }

    /**
     * Get the state.
     * @return the state.
     */
    public int getState() {
        return m_iState;
    }

    /**
     * Set the state completed.
     */
    public void setStateCompleted() {
        m_iState = COMPLETED_STATE;
    }

    /**
     * Set the state running.
     */
    public void setStateRunning() {
        m_iState = RUNNING_STATE;
    }

    /**
     * Set the state queued.
     */
    public void setStateQueued() {
        m_iState = QUEUED_STATE;
    }

    /**
     * Set the result RMPI IA Wrapper.
     * @param rmpiIAWrapper the result RMPI IA Wrapper.
     */
    public void setRMPIIAWrapper(RMPIIAWrapper rmpiIAWrapper) {
        m_oRMPIIAWrapper = rmpiIAWrapper;
    }

    /**
     * Get the result RMPI IA Wrapper.
     * @return the result RMPI IA Wrapper.
     */
    public RMPIIAWrapper getRMPIIAWrapper() {
        return m_oRMPIIAWrapper;
    }
}
